#!/usr/bin/env python
# -- coding: utf-8 --
# @Time : 2023/1/28 10:24
# @Coder: Pithon
# @IDE : PyCharm
# @WEB : http://pithon.top
# ==============================
import os

import ffmpy


def webm2mp4(industry, year, month):
    print(f'正在转换{industry}_rank_bar_{year}{month}')
    if not os.path.exists(f'./videos/{industry}'):
        os.makedirs(f'./videos/{industry}')
    input_file = fr'C:\Users\ex_yanpsh\Downloads\{industry}_rank_bar_{year}{month}.webm'
    output_file = f'./videos/{industry}/rank_bar_{year}{month}.mp4'

    ff = ffmpy.FFmpeg(
        inputs={input_file: None},
        outputs={output_file: None},
        global_options=['-loglevel','warning']
    )
    print(ff.cmd)
    ff.run()
